package org.example.bean;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @author fy
 * @version 1.0
 * @Description
 * @date 2024/12/13 14:58
 */
@Component
@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class R {
    private int code=200;//状态
    private String msg="成功";//消息
    private Map<String,Object> data=new HashMap<String,Object>();
    public R add(String key, Object value){
        this.data.put(key,value);
        return this;
    }

    public R setMsg(String msg) {

        this.msg = msg;
        return this;
    }
    public R setCode(int code) {
        this.code = code;
        return this;
    }
}
